#!/bin/bash
if [ $# -lt 1 ]
then
  echo "start or stop???"
  exit
fi

case $1 in
start)
  echo "===============START HDFS==============="
  ssh hadoop202 $HADOOP_HOME/sbin/start-dfs.sh
  
  echo "===============START YARN==============="
  ssh hadoop203 $HADOOP_HOME/sbin/start-yarn.sh

  echo "===============START HISTORY==============="
  ssh hadoop202 mapred --daemon start historyserver
;;
stop)
  echo "===============STOP HDFS==============="
  ssh hadoop202 $HADOOP_HOME/sbin/stop-dfs.sh
  
  echo "===============STOP YARN==============="
  ssh hadoop203 $HADOOP_HOME/sbin/stop-yarn.sh

  echo "===============STOP HISTORY==============="
  ssh hadoop202 mapred --daemon stop historyserver
;;
*)
  echo "args is error"
;;
esac
